    <template v-for="item in this.menuData">
      <el-submenu v-if="item.children&&item.children.length>0"
                  :key="item.id"
                  :index="item.path">
        <template slot="title">
          <span>{{item.pathName}}</span>
        </template>

        <menu-tree :menuData="item.children"></menu-tree>

      </el-submenu>
      <el-menu-item v-else :key="item.id" :index="item.value">{{item.pathName}}</el-menu-item>
    </template>

<script>
export default {
  name: "menu-tree",//必须要 递归组件的关键，并且要与引入组件的变量名称一致
  props: ["menuData"],
};
</script>
